<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('终端划拨记录列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 120px">服务商编号：</label>
                            <input type="text" name="agentNum" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"/>
                        </li>
                        <li>
                            <label style="width: 120px">服务商名称：</label>
                            <input type="text" name="agentName"/>
                        </li>
                        <li>
                            <label style="width: 100px;">终端类型：</label>
                            <select name="posType" th:with="type=${@dict.getType('terminal_type')}">
                                <option value="-1">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="searchTable()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var datas1 = [[${@dict.getType('terminal_type')}]];
    var prefix = ctx + "terminal/posCount";

    $(function() {
        var options = {
            url: prefix + "/posCountSumList",
            modalName: "二段达标记录",
            columns: [
                {
                    field: 'agentNum',
                    title: '服务商编号'
                },
                {
                    field: 'agentName',
                    title: '服务商名称'
                },

                {
                    field: 'posCount',
                    title: '台数'
                },
                {
                    field: 'posType',
                    title: '终端类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas1, value);
                    }
                },
               ]
        };
        $.table.init(options);
    });

    function searchTable(){
        var agentNum = $("[name = 'agentNum']").val();
        if (!agentNum){
            $.modal.alertWarning("请输入服务商编号");
            return false;
        };
        $.table.search();
    }
</script>
</body>
</html>